htmltools::includeMarkdown('indice.md')
pltnts <- list.files("~/R/terni/rds", pattern = "^[A-L]", full.names = TRUE) 

map(pltnts, \(pltnt) {
  inquinante <- tools::file_path_sans_ext(basename(pltnt))
  
  cat("\n## ", inquinante, "\n\n")

  df <- read_csv("~/R/terni/data/dataframes/df_finale.csv", show_col_types = FALSE)
  index <- grep(inquinante, names(df))
  names(df)[index] <- "value"

  rds <- readRDS(pltnt)
  mod <- getModel(names(rds), df)
  
  gamtabs(mod, type = "HTML")
  cat("\n\n")
    
  cat("R²:", summary(mod)$r.sq %>% round(3) )
cat("\n\n")
  # stargazer(mod, type="text" )

  appraise(mod) %>% print()
  draw(mod) %>% print()
  
  rm(mod)
  cat("\n\n")
})

Al_i

stringa modello: gam(log(value) ~ s(tp_max) + s(t2m_IQR) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.6455 0.0048 345.0029 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(tp_max) 4.0117 4.5928 16.0655 < 0.0001
s(t2m_IQR) 1.3790 1.5696 9.1918 0.0004

R²: 0.275

Al_s

stringa modello: gam(log(value) ~ s(pbl12_min) + s(scrapyard) + s(sp_IQR) + s(wspeed_max_max) + s(tp_median, k=3) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 0.6054 0.0168 36.0994 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pbl12_min) 1.0001 1.0002 18.4363 < 0.0001
s(scrapyard) 3.9608 4.8647 7.4353 < 0.0001
s(sp_IQR) 1.0000 1.0001 58.1864 < 0.0001
s(wspeed_max_max) 2.4165 2.8309 20.3789 < 0.0001
s(tp_median) 1.8030 1.9107 6.0010 0.0028

R²: 0.647

As_i

stringa modello: gam(log(value) ~ s(pbl12_median) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.7978 1099012885.8576 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(pbl12_median) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

As_s

stringa modello: gam(log(value) ~ s(cold_area) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -24.3739 1470767797.3404 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(cold_area) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

B_i

stringa modello: gam(log(value) ~ s(pwspeed_IQR) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -8.2656 72.9295 -0.1133 0.9098
B. smooth terms edf Ref.df F-value p-value
s(pwspeed_IQR) 4.9512 5.0933 3.7966 0.0020

R²: 0.39

B_s

stringa modello: gam(log(value) ~ s(wspeed_max) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.9984 1108.9985 -0.0216 0.9828
B. smooth terms edf Ref.df F-value p-value
s(wspeed_max) 8.0000 8.0001 6.7448 < 0.0001

R²: 0.494

Ba_i

stringa modello: gam(log(value) ~ s(pbl00_IQR) + s(imp_200) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -0.7146 234.0267 -0.0031 0.9976
B. smooth terms edf Ref.df F-value p-value
s(pbl00_IQR) 8.0001 8.0001 8.2615 < 0.0001
s(imp_200) 1.0000 1.0000 6.0656 0.0144

R²: 0.68

Ba_s

stringa modello: gam(log(value) ~ s(pbl12_mean) + s(s8_sup_200) + s(pop_200) + s(pbl12_max) + s(wspeed_IQR) + s(wspeed_max) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 0.3907 0.0170 23.0436 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pbl12_mean) 1.0000 1.0001 0.4034 0.5259
s(s8_sup_200) 2.4015 3.0389 10.0470 < 0.0001
s(pop_200) 1.0000 1.0000 9.1488 0.0027
s(pbl12_max) 4.3058 5.0450 11.0489 < 0.0001
s(wspeed_IQR) 1.0000 1.0001 110.4326 < 0.0001
s(wspeed_max) 1.8379 2.1012 11.7025 < 0.0001

R²: 0.658

Bi_i

stringa modello: gam(log(value) ~ s(wdir_min) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.3786 728888923.6442 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(wdir_min) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Bi_s

stringa modello: gam(log(value) ~ s(kndvi) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.7952 820896902.7941 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(kndvi) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Ca_i

stringa modello: gam(log(value) ~ s(pblmin_max) + s(tp_IQR) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.9101 0.0047 407.1479 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pblmin_max) 1.0001 1.0002 36.5603 < 0.0001
s(tp_IQR) 4.0549 4.5367 26.1999 < 0.0001

R²: 0.451

Ca_s

stringa modello: gam(log(value) ~ s(nirradiance_IQR) + s(bh_200) + s(s8_sup_200) + s(tmin2m_max) + s(s6_sup_200) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.8921 0.0027 688.8894 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(nirradiance_IQR) 2.2636 2.6515 58.4584 < 0.0001
s(bh_200) 3.8818 4.6559 6.5691 < 0.0001
s(s8_sup_200) 5.2758 6.2124 5.8510 < 0.0001
s(tmin2m_max) 2.3224 2.8845 8.0398 < 0.0001
s(s6_sup_200) 1.0002 1.0004 8.4140 0.0040

R²: 0.529

Cd_i

stringa modello: gam(log(value) ~ s(s5_sup_200, k=9) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.4419 448071431.0465 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(s5_sup_200) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Cd_s

stringa modello: gam(log(value) ~ s(v10m_min) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.5796 387687954.4849 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(v10m_min) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Ce_i

stringa modello: gam(log(value) ~ s(s7_sup_200, k=3) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.4443 464327192.8477 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(s7_sup_200) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Ce_s

stringa modello: gam(log(value) ~ s(t2m_min) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.4449 575094374.2699 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(t2m_min) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Co_i

stringa modello: gam(log(value) ~ s(cold_area) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -69.3581 262156066.4195 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(cold_area) 1.0000 1.0000 0.0000 1.0000

R²: 0.053

Co_s

stringa modello: gam(log(value) ~ s(kndvi) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.8396 653381530.1422 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(kndvi) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Cr_i

stringa modello: gam(log(value) ~ s(cold_area) + s(wdir_IQR) + s(s6_sup_200) + s(u10m_median, k=9) + s(s1_sup_200, k=7) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.1558 0.0069 166.5089 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(cold_area) 4.6024 5.4578 61.4565 < 0.0001
s(wdir_IQR) 1.0000 1.0001 150.3107 < 0.0001
s(s6_sup_200) 7.1140 7.9155 8.7323 < 0.0001
s(u10m_median) 1.0001 1.0001 46.2379 < 0.0001
s(s1_sup_200) 1.6618 1.8638 3.8679 0.0136

R²: 0.744

Cs_i

stringa modello: gam(log(value) ~ s(wdir_max) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.1515 404332678.1999 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(wdir_max) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Cs_s

stringa modello: gam(log(value) ~ s(wspeed_min, k=8) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.6596 563533184.0973 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(wspeed_min) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Cu_i

stringa modello: gam(log(value) ~ s(pblmax_mean) + s(s5_sup_200, k=9) + s(s6_sup_200) + s(m_dis_ferr) + s(s3_sup_200) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 0.7405 0.0091 81.4914 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pblmax_mean) 4.3271 5.1926 76.1385 < 0.0001
s(s5_sup_200) 7.4404 7.7783 13.3667 < 0.0001
s(s6_sup_200) 1.1743 1.3090 5.8071 0.0080
s(m_dis_ferr) 1.0001 1.0002 26.4269 < 0.0001
s(s3_sup_200) 4.1164 4.6546 7.7620 < 0.0001

R²: 0.678

Cu_s

stringa modello: gam(log(value) ~ s(nirradiance_mean) + s(hot_area) + s(m_dis_ferr) + s(s4_sup_200) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -0.2545 0.0394 -6.4615 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(nirradiance_mean) 7.9657 8.4567 26.1746 < 0.0001
s(hot_area) 8.6498 8.9592 9.3167 < 0.0001
s(m_dis_ferr) 1.0001 1.0001 10.0428 0.0017
s(s4_sup_200) 1.6659 1.9615 3.9791 0.0361

R²: 0.651

Fe_i

stringa modello: gam(log(value) ~ s(wdir_IQR) + s(cold_area) + s(wspeed_max_mean) + s(s5_sup_200, k=9) + s(s3_sup_200) + s(s4_sup_200) + s(s1_sup_200, k=7) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.8038 0.0032 558.8771 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(wdir_IQR) 3.7184 4.5237 20.0079 < 0.0001
s(cold_area) 8.9648 8.9971 26.8025 < 0.0001
s(wspeed_max_mean) 1.0000 1.0001 19.7659 < 0.0001
s(s5_sup_200) 1.0000 1.0000 33.8379 < 0.0001
s(s3_sup_200) 1.0000 1.0000 22.1570 < 0.0001
s(s4_sup_200) 1.9781 2.2997 5.6069 0.0033
s(s1_sup_200) 1.0000 1.0001 5.9050 0.0158

R²: 0.637

Fe_s

stringa modello: gam(log(value) ~ s(pbl12_mean) + s(m_dis_ferr) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 0.7988 0.0150 53.1779 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pbl12_mean) 8.8137 8.9888 27.1550 < 0.0001
s(m_dis_ferr) 1.9068 2.3652 7.6610 0.0004

R²: 0.61

Ga_i

stringa modello: gam(log(value) ~ s(v10m_median, k=9) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.4915 399086832.8146 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(v10m_median) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Ga_s

stringa modello: gam(log(value) ~ s(v10m_median, k=9) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.8122 885536862.8724 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(v10m_median) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

K_i

stringa modello: gam(log(value) ~ s(pbl00_IQR) + s(pwspeed_min, k=7) + s(pblmin_max) + s(s6_sup_200) + s(pwspeed_IQR) + s(nirradiance_min) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.8271 0.0067 272.6002 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(pbl00_IQR) 1.5539 1.7218 21.4260 < 0.0001
s(pwspeed_min) 1.0000 1.0000 135.6251 < 0.0001
s(pblmin_max) 3.1130 3.4339 32.5927 < 0.0001
s(s6_sup_200) 1.1279 1.2438 5.2072 0.0131
s(pwspeed_IQR) 2.0066 2.2014 4.7931 0.0136
s(nirradiance_min) 1.0001 1.0002 32.4704 < 0.0001

R²: 0.727

K_s

stringa modello: gam(log(value) ~ s(sp_max) + s(sp_mean) + s(nirradiance_IQR) + s(tmax2m_IQR) , gamma=1.4, family=gaussian(link=log), data = df)
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) 1.6976 0.0046 368.3042 < 0.0001
B. smooth terms edf Ref.df F-value p-value
s(sp_max) 1.0000 1.0001 354.5608 < 0.0001
s(sp_mean) 1.9732 2.4231 2.1526 0.0695
s(nirradiance_IQR) 1.0013 1.0025 12.5933 0.0004
s(tmax2m_IQR) 1.0000 1.0000 12.0815 0.0006

R²: 0.792

La_i

stringa modello: gam(log(value) ~ s(pblmin_median, k=3) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.4328 658563871.6587 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(pblmin_median) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

La_s

stringa modello: gam(log(value) ~ s(pblmin_IQR, k=9) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -22.9853 1033837054.2196 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(pblmin_IQR) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Li_i

stringa modello: gam(log(value) ~ s(s7_sup_200, k=3) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.1998 628699215.4837 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(s7_sup_200) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

Li_s

stringa modello: gam(log(value) ~ s(pblmin_median, k=3) , gamma=1.4, family=gaussian(link=log), data = df)

## Warning in log(mu): Si è prodotto un NaN
A. parametric coefficients Estimate Std. Error t-value p-value
(Intercept) -23.0640 526087096.1012 -0.0000 1.0000
B. smooth terms edf Ref.df F-value p-value
s(pblmin_median) 1.0000 1.0000 0.0000 1.0000

R²: -0.004

[[1]] NULL

[[2]] NULL

[[3]] NULL

[[4]] NULL

[[5]] NULL

[[6]] NULL

[[7]] NULL

[[8]] NULL

[[9]] NULL

[[10]] NULL

[[11]] NULL

[[12]] NULL

[[13]] NULL

[[14]] NULL

[[15]] NULL

[[16]] NULL

[[17]] NULL

[[18]] NULL

[[19]] NULL

[[20]] NULL

[[21]] NULL

[[22]] NULL

[[23]] NULL

[[24]] NULL

[[25]] NULL

[[26]] NULL

[[27]] NULL

[[28]] NULL

[[29]] NULL

[[30]] NULL

[[31]] NULL

[[32]] NULL

[[33]] NULL